package ch1.refactors;

import lombok.Getter;

public class Movie {
    @Getter
    private String title;

    private Price _price;

    final static int REGULAR = 1;

    final static int NEW_RELEASE = 2;

    final static int CHILDRENS = 3;

    public Movie(String title, int priceCode) {
        this.title = title;
        setPriceCode(priceCode);
    }
    double getCharge(int daysRented){
        return _price.getCharge(daysRented);
    }

    public int getPriceCode(){

        return _price.getPriceCode();
    }

    public void setPriceCode(int arg){
        switch (arg){
            case REGULAR:
                _price = new RegularPrice();
                break;
            case CHILDRENS:
                _price = new ChildrensPrice();
                break;
            case NEW_RELEASE:
                _price = new NewReleasePrice();
                break;
            default:
                throw new IllegalArgumentException("Incorrect Price Code");
        }
    }

    public int getFrequentRentalPoints(int daysRented){
        return this._price.getFrequentRenterPoints(daysRented);
    }

}
